package com.hycc.base;

public class YieldTt {
    public static void main(String[] args) {
        MyYield myYield = new MyYield();

        new Thread(myYield,"first").start();
        new Thread(myYield,"second").start();
    }
}


class MyYield implements Runnable{
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName()+"线程开始");
        Thread.yield();
        System.out.println(Thread.currentThread().getName()+"线程结束");
    }
}
